package com.xxx.question.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xxx.question.entity.QmsTypeEntity;
import com.xxx.question.service.QmsTypeService;
import com.xxx.common.utils.PageUtils;
import com.xxx.common.utils.R;
import sun.net.idn.Punycode;


/**
 * 题目-题目类型表
 *
 * @author platov
 * @email platov@admin.com
 * @date 2024-09-17 13:06:56
 */
@RestController
@RequestMapping("question/qmstype")
public class QmsTypeController {
    @Autowired
    private QmsTypeService qmsTypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = qmsTypeService.queryPage(params);

        return R.ok().put("page", page);
    }

    @RequestMapping("/findAll")
    public R findAll() {
        List<QmsTypeEntity> qmsTypeEntityList = qmsTypeService.findAll();
        return R.ok().put("data", qmsTypeEntityList);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		QmsTypeEntity qmsType = qmsTypeService.getById(id);

        return R.ok().put("qmsType", qmsType);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody QmsTypeEntity qmsType){
		qmsTypeService.save(qmsType);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody QmsTypeEntity qmsType){
		qmsTypeService.updateById(qmsType);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		qmsTypeService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
